package sn.gandal.mobile.kalpet.adaptators;

import java.util.HashMap;
import java.util.Map;

import sn.gandal.mobile.kalpet.R;
import sn.gandal.mobile.kalpet.utils.KalpetConstants;
import android.content.Context;
import android.content.res.ColorStateList;
import android.graphics.Color;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.GridView;
import android.widget.ImageView.ScaleType;
import android.widget.TextView;

public class TextViewAdapter extends BaseAdapter {
	
	private Context context;
	
	/*public static int[] imagesViews={
								   R.id.tvGestionA,
								   R.id.tvGestionB, 
								   R.id.tvGestionC, 
								   R.id.tvGestionV,
								   R.id.tvGestionH, 
								  // R.id.tvServices, 
								   R.id.tvGestionVirement
								   };
								   */
	public static final String[] textString = new String[] {  KalpetConstants.GESTION_ACHATS ,
												    KalpetConstants.GESTION_BONS ,
													KalpetConstants.GESTION_COMPTES ,
													KalpetConstants.GESTION_VENTES , 
													KalpetConstants.GESTION_HISTORIQUES,
													//KalpetConstants.MES_SERVICES ,
													KalpetConstants.GESTION_VIREMENTS
		};
	/* static final String[] numbers = new String[] {  "GESTION ACHATS" ,
	    "GESTION BONS" ,
		"GESTION COMPTES" ,
		"GESTION_VENTES" , 
		"GESTION HISTORIQUES",
		"MES SERVICES" ,
}; */
	private final Map<Integer,String> maps=new HashMap<Integer, String>();
	

	@Override
	public int getCount() {
		// TODO Auto-generated method stub
		return textString.length;
	}
	public TextViewAdapter(Context context){
		this.context=context;
		//initMaps();
	}
	
	@Override
	public Object getItem(int pos) {
		// TODO Auto-generated method stub
		return textString[pos];
	}

	@Override
	public long getItemId(int arg0) {
		// TODO Auto-generated method stub
		return 0;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		// TODO Auto-generated method stub
		View view;
		if(convertView !=null){
			view=convertView;
		}else{
			LayoutInflater li = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
	        view = li.inflate(R.layout.text_view_adapter, null);
			
			//View v= LayoutInflater.from(context).inflate(R.layout.text_view_adapter, null);
		   TextView tv= (TextView) view.findViewById(R.id.gestion);
		   // tv=new TextView(context);
		   // tv.setLayoutParams(new GridView.LayoutParams(60,60));
		   // tv.setGravity(Gravity.CENTER);
		   // tv.setTextSize(10);
		    tv.setTextColor(Color.WHITE);
		   // tv.setPadding(-1, -1, -1, -1);
		   // tv.setTextColor(android.c);
		    tv.setText(textString[position]); // numbers[position]);
		    
		}
		
		
		return view;
	}
	
/*	private void initMaps() {
		// TODO Auto-generated method stub
		maps.put(textViews[0], numbers[0]);
		maps.put(textViews[1], numbers[1]);
		maps.put(textViews[2], numbers[2]);
		maps.put(textViews[3], numbers[3]);
		maps.put(textViews[4], numbers[4]);
		maps.put(textViews[5], numbers[5]);
		//maps.put(textViews[6], numbers[6]);
	}
*/
	public static String getItemNameAtPosition(int pos){
		return textString[pos];
	}
}
